package spms.config;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class ContextConfig implements ApplicationContextAware {

    public static ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        ContextConfig.applicationContext = applicationContext;
    }

    @Value("${server.port}")
    public void setPort(String port) {
        LogConfig.port = port;
    }

    @Value("${spring.application.name}")
    public void setAppName(String appName) {
        LogConfig.appName = appName;
    }

}
